import 'package:dio/dio.dart';
import 'package:dio/dio.dart';

class LogsInterceptors extends InterceptorsWrapper {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    // TODO: implement onRequest
    super.onRequest(options, handler);

    // print("请求baseUrl：${options.baseUrl}");
    // print("请求url：${options.path}");
    // print('请求头: ' + options.headers.toString());
    // if (options.data != null) {
    //   print('请求参数: ' + options.data.toString());
    // }
  }

  @override
  void onResponse(Response response, ResponseInterceptorHandler handler) {
    super.onResponse(response, handler);

    if (response != null) {
      var responseStr = response.toString();
      // print('请求结果：' + responseStr);
    }
  }

  @override
  void onError(DioError err, ErrorInterceptorHandler handler) {
    super.onError(err, handler);

    print('请求异常: ' + err.toString());
    print('请求异常信息: ' + err.response.toString());
  }
}
